

import java.io.BufferedInputStream;
import java.io.IOException;

public final class HttpUtil
{
	public final static String CRLF = "\r\n";

	public static boolean startsWith(String a, String what)
	{
		return (a.toUpperCase().indexOf(what.toUpperCase()) == 0);
	}
	public static String readLine(BufferedInputStream bis) throws IOException
	{
		StringBuffer line = new StringBuffer();
		int ch;
		while (true)
		{
			ch = bis.read();
			if (ch == -1)
				break;
			if (ch == '\r' || ch == '\n')
			{
				if (ch == '\r')
				{
					ch = bis.read();
				}
				break;
			}
			line.append((char) ch);
		}
		if (ch == -1 && line.length() == 0)
			return null;
		else
			return line.toString();
	}

	public static int read(BufferedInputStream bis) throws IOException
	{
		return bis.read();
	}

	public static byte[] addByteCapacity(byte[] rece)
	{
		byte[] temp = new byte[rece.length + 1024];
		System.arraycopy(rece, 0, temp, 0, rece.length);
		return temp;
	}
}
